<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class CreateCategoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category', function (Blueprint $table) {
            $table->id("cat_id");
            $table->string("cat_name")->comment("类别名称");
            $table->integer("parent_id")->comment("父级id")->nullable();
            $table->integer("sort_order")->comment("排序")->default(0);
            $table->integer("level")->comment("等级")->nullable();
            $table->string("parent_id_path")->comment("路径")->nullable();
        });
        DB::statement("ALTER TABLE `category` comment'部门表'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('category');
    }
}
